﻿using ASmile.Win;
using ASmile.Win.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace ASmile.CodeFactory
{
    public partial class FrmMain : FrmMDI
    {
        public FrmMain()
        {
            InitializeComponent();
        }

        protected override bool IsManager => true;

        void ShowTabForm<T>(string caption = null) where T : Control, new()
        {
            ShowTabForm<T>(dockPanel1, caption);
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            LoginUser.UserId = "00";
            LoginUser.RoleId = "00";
            LoginUser.DeptId = "00";
            LoginUser.IsManager = true;
            LoginUser.UserName = "代码管理员";

        }

        private void tsbtnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!ShowQuestion("确实要退出吗？", "退出确认"))
            {
                e.Cancel = true;
            }
        }

        private void tsBtnConfig_Click(object sender, EventArgs e)
        {
            ShowTabForm<FrmConfig>("连接配置");
        }

        private void tsBtnTableNotes_Click(object sender, EventArgs e)
        {
            ShowTabForm<FrmRemark>("备注管理");
        }

        private void tsBtnCodeBuilder_Click(object sender, EventArgs e)
        {
            ShowTabForm<FrmCodeBuilder>("代码生成");
        }
    }
}